if(!window.console){console = {};console.debug = console.info = console.log = function(){}}

/** 
 * @author: BeanMao
 * @date: 20100418
 * @desc:define the Packages. Mao{} for some technique, and Bean{} for some functional widgets.
 */

var Mao = Bean = {};

// extend method
Mao.extend = function(sourceObj, tarObj, isCover){
	if(typeof isCover!=="boolean"){isCover = true};
	for(var i in tarObj){
		if(typeof sourceObj[i]==="undefined"||isCover){
			sourceObj[i] = tarObj[i];
		}
	}
}

Mao.extend(Mao, {
	// replace document.getElementById method.
	$$: function(id){ return document.getElementById(id);},
	$C: function(theClassName){
		if(document.getElementsByClassName){ //FF
			return document.getElementsByClassName(theClassName);
		}else{//IE
			var i=0, divs = gt("div"),res = [];
			for(var i=0; i<divs.length;i++){
				if(divs[i].className==theClassName){
					res.push(divs[i]);
				}
			}
			return res;
		}
	},
	$T: function(tagName){
		return document.getElementsByTagName(tagName);
	}
});

